#ifndef _UserInfo_h_
#define _UserInfo_h_

#include "Global.h"

class UserInfo
	: public cocos2d::CCNode
	, public cocos2d::extension::CCBMemberVariableAssigner
	, public cocos2d::extension::CCBSelectorResolver
    , public CCNodeLoaderListener
{
public:
	CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(UserInfo, create);

	UserInfo(void);
	~UserInfo(void);

	virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
	virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
	virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode);
    virtual void onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader);

	bool init();
	void refresh();

	void onEnter();
	void onExit();

private:
	cocos2d::CCLabelTTF* mLevel;
	cocos2d::CCLabelTTF* mName;
	cocos2d::CCLabelTTF* mEnergy;
	cocos2d::CCLabelTTF* mPower;
	cocos2d::CCLabelTTF* mGold;
	cocos2d::CCLabelTTF* mMoney;
    ProgressText* mProgress;
    
    void _onNotification(CCObject* object);
	
public:
	void setLevel(unsigned int level);
	void setUserName(char* name);
	void setEnergy(unsigned int cur, unsigned int max);
	void setGold(unsigned int gold);
	void setExp(unsigned int exp);

	void onLevelClick(cocos2d::CCObject * pSender);
};

#endif